package usermanager

import grails.test.*

class PersonTests extends GrailsUnitTestCase {
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testSomething() {
		def pers = new Person()
		mockForConstraintsTests(Person, [pers])
		def testPerson = new Person();
		assertFalse "there should be errors", testPerson.validate()
		testPerson = new Person(firstName:"a", lastName: "Bi")
		assertFalse testPerson.validate()
		assertEquals "size", testPerson.errors["firstName"]
		assertTrue "All errors for Person(firstName: a, lastName: Bi):", testPerson.hasErrors()
		println "\nErrors:"
		println testPerson.errors
		testPerson = new Person()
		testPerson.firstName = "John"
		testPerson.lastName = "Smith"
		testPerson.projects = new Project(projectName : "Name")
		assertTrue testPerson.validate() 
    }
}
